gl renderer: Fix repeat nodes that don't repeat
authorTimm Bäder <mail@baedert.org>
Tue, 19 Nov 2019 09:31:21 +0000 (10:31 +0100)
committerTimm Bäder <mail@baedert.org>
Tue, 19 Nov 2019 09:31:21 +0000 (10:31 +0100)
Fixes #2234

gsk/gl/gskglrenderer.c
gsk/resources/glsl/repeat.fs.glsl

index 1e1086d7611c5506d105dbabf19159122371f8bd..357e09108d45e522d0719efb5174f0a590628451 100644 (file)
@@ -1973,8 +1973,8 @@ render_repeat_node (GskGLRenderer   *self,
   ops_set_texture (builder, region.texture_id);
 
   op = ops_begin (builder, OP_CHANGE_REPEAT);
-  op->child_bounds[0] = 0; /* Both currently unused */
-  op->child_bounds[1] = 0;
+  op->child_bounds[0] = (node->bounds.origin.x - child_bounds->origin.x) / child_bounds->size.width;
+  op->child_bounds[1] = (node->bounds.origin.y - child_bounds->origin.y) / child_bounds->size.height;
   op->child_bounds[2] = node->bounds.size.width / child_bounds->size.width;
   op->child_bounds[3] = node->bounds.size.height / child_bounds->size.height;
 
index a58047335ed998d41755c1e5284821f3dc81c27e..070b56abe6098997540f90daf3e0a47beeb3c8e9 100644 (file)
@@ -21,8 +21,8 @@ void main() {
   float mapped_x = (vUv.x - u_texture_rect.x) / tw;
   float mapped_y = (vUv.y - u_texture_rect.y) / th;
 
-  float wrapped_x = wrap(mapped_x * u_child_bounds.z, 1.0);
-  float wrapped_y = wrap(mapped_y * u_child_bounds.w, 1.0);
+  float wrapped_x = u_child_bounds.x + wrap(mapped_x * u_child_bounds.z, 1.0);
+  float wrapped_y = u_child_bounds.y + wrap(mapped_y * u_child_bounds.w, 1.0);
 
   vec2 tp;
   tp.x = u_texture_rect.x + (wrapped_x * tw);